home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13262 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.7 KB  |  154 lines

  1. Path: news.connectnet.com!usenet
  2. From: Brain <provstu@cts.com>
  3. Newsgroups: comp.lang.c,comp.lang.c++,comp.binaries.wanted
  4. Subject: Re: need: dos.h (C header file) including inportb() and outportb() functions!!!
  5. Date: Fri, 05 Apr 1996 09:35:16 -0800
  6. Organization: Providenc Communications
  7. Message-ID: <316559D4.3FF5@cts.com>
  8. References: <4ih1pu$7q5@vip.cybercity.dk> <827777154.4588@mmd-uk.demon.co.uk>
  9. NNTP-Posting-Host: max-nc-83.connectnet.com
  10. Mime-Version: 1.0
  11. Content-Type: multipart/mixed; boundary="------------75077D41B9E"
  12. X-Mailer: Mozilla 2.01 (Win16; I)
  13.  
  14. This is a multi-part message in MIME format.
  15.  
  16. --------------75077D41B9E
  17. Content-Type: text/plain; charset=us-ascii
  18. Content-Transfer-Encoding: 7bit
  19.  
  20. rich@mmd-uk.demon.co.uk wrote:
  21. > monsted@cybercity.dk (Monsted) wrote:
  22. > >o<I need a dos.h header file that includes inportb and outportb
  23. > >o<functions for COM & LPT I/O!
  24. > >o<These functions are not included in MSVC++!
  25. > Well, Attatched to this message is DOS.H.It has Everything you need!
  26.  
  27. --------------75077D41B9E
  28. Content-Type: text/plain; charset=us-ascii
  29. Content-Transfer-Encoding: 7bit
  30. Content-Disposition: inline; filename="DOS.H"
  31.  
  32. /*
  33.  *    Structures for the dos interface routines:
  34.  *        intdos()
  35.  *        intdosx()
  36.  *        int86()
  37.  *        int86x()
  38.  *        segread()
  39.  *        intr()
  40.  *        driver()
  41.  *        driverx()
  42.  */
  43.  
  44. struct WORDREGS {
  45.     unsigned int ax;
  46.     unsigned int bx;
  47.     unsigned int cx;
  48.     unsigned int dx;
  49.     unsigned int si;
  50.     unsigned int di;
  51.     unsigned int cflag;
  52.     unsigned int psw;
  53. };
  54.  
  55. struct BYTEREGS {
  56.     unsigned char al, ah;
  57.     unsigned char bl, bh;
  58.     unsigned char cl, ch;
  59.     unsigned char dl, dh;
  60. };
  61.  
  62. union REGS {
  63.     struct WORDREGS x;
  64.     struct BYTEREGS h;
  65. };
  66.  
  67. struct SREGS {
  68.     unsigned int es;
  69.     unsigned int cs;
  70.     unsigned int ss;
  71.     unsigned int ds;
  72. };
  73.  
  74. struct WORDREGPACK {
  75.     unsigned int    ax;
  76.     unsigned int    bx;
  77.     unsigned int    cx;
  78.     unsigned int    dx;
  79.     unsigned int    bp;
  80.     unsigned int    si;
  81.     unsigned int    di;
  82.     unsigned int    ds;
  83.     unsigned int    es;
  84.     unsigned int    flags;
  85. };
  86.  
  87. union REGPACK {
  88.     struct WORDREGPACK    x;
  89.     struct BYTEREGS        h;
  90. };
  91.  
  92. /*    The following macros split a long pointer (large model) into
  93.  *    offset and segment parts.
  94.  */
  95.  
  96. #define FP_OFF(ptr)    ((unsigned short)(ptr))
  97. #define FP_SEG(ptr)    (((long)(far void *)(ptr)) >> 16)
  98.  
  99. /*    construct a far pointer from segment and offset */
  100.  
  101. #if    LARGE_DATA
  102. #define    FP_CONSTRUCT(seg, offs)    ((void *)(((long)(seg) << 16) + (offs)))
  103. #else
  104. #define    FP_CONSTRUCT(seg, offs)    ((far void *)(((long)(seg) << 16) + (offs)))
  105. #endif
  106.  
  107. #define    MK_FP(seg, offs)    FP_CONSTRUCT(seg, offs)
  108.  
  109. extern int    intdos(union REGS *, union REGS *);
  110. extern int    intdosx(union REGS *, union REGS *, struct SREGS *);
  111. extern int    int86x(int, union REGS *, union REGS *, struct SREGS *);
  112. extern int    int86(int, union REGS *, union REGS *);
  113. extern int    driverx(far void *, union REGS *, struct SREGS *);
  114. extern int    driver(far void *, union REGS *);
  115. extern void    intr(int, union REGPACK *);
  116. extern int    segread(struct SREGS *);
  117. extern long    msdos(int, ...);
  118. extern long    msdoscx(int, ...);
  119. typedef    int (*    __critf_)(unsigned char, unsigned char);
  120. extern __critf_    set_crithand(__critf_);
  121. extern int    isnec98(void);
  122. extern int    _dos_getftime(int, unsigned short *, unsigned short *);
  123. extern unsigned char    __in_crithand__;
  124. extern void    nosound(void);
  125. extern void    sound(unsigned int frequency);
  126.  
  127. /*
  128.  *    Byte port I/O macros
  129.  */
  130.  
  131. #define    inp(p)        (*(port unsigned char *)(p))
  132. #define    inportb(p)    (*(port unsigned char *)(p))
  133. #define    outp(p,v)    (*(port unsigned char *)(p) = (v))
  134. #define    outportb(p,v)    (*(port unsigned char *)(p) = (v))
  135.  
  136. /*
  137.  *    Word port I/O macros
  138.  */
  139.  
  140. #define    inpw(p)        (*(port unsigned short *)(p))
  141. #define    inport(p)    (*(port unsigned short *)(p))
  142. #define    outpw(p,v)    (*(port unsigned short *)(p) = (v))
  143. #define    outport(p,v)    (*(port unsigned short *)(p) = (v))
  144.  
  145. /*
  146.  *    End of DOS.H
  147.  */
  148.  
  149. --------------75077D41B9E--
  150.  
  151.